package org.opencv.facetrackmatch.facedetect;

import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;

public class JudgeInstallAPK {
	private Context context;

	public JudgeInstallAPK(Context context) {
		this.context = context;
	}

	public boolean checkApkExist(String packageName) {
		if (packageName == null || "".equals(packageName))
			return false;
		try {
			context.getPackageManager().getApplicationInfo(packageName,
					PackageManager.GET_UNINSTALLED_PACKAGES);

			return true;
		} catch (NameNotFoundException e) {
			return false;
		}
	}
}
